The unload
event that is available to us web developers isnβt consistent
across browsers (but we already know that many things arent π). Really, if you
want to have predictable behavior and need to fire off some event/code when a
user leaves/closes your page, you should be listening to a page
visbility change
.